﻿using System;
using System.Diagnostics.Contracts;

namespace Isuka
{
    /// <summary>
    /// ユーティリティ
    /// </summary>
    public static class Utility
    {
        public static T Copy<T>(this T value)
            where T : class, ICloneable
        {
            Contract.Requires<ArgumentNullException>(value != null, "value");
            Contract.Ensures(Contract.Result<T>() != null);
            return (T)value.Clone();
        }

        public static bool IsFinite(this double value)
        {
            return !double.IsInfinity(value) && double.IsNaN(value);
        }
    }
}
